<template>
	<view>
		<uni-evaluate :listData="listData" />

		<view class="bottom-element">hello world</view>
	</view>

</template>

<script>
	import {
		GetActivateComment
	} from "@/api/activate.js"
	import uniEvaluate from '@/components/xiujun-evaluate/uni-evaluate.vue';
	export default {
		components: {
			uniEvaluate
		},
		data() {
			return {
				userId: null,
				listData: [{
						header_img: "http://cs.zhangkaixing.com/face/face_2.jpg",
						user_name: "scy",
						rate: 5,
						create_time: "2019-04-12",
						content: "好评1",
						imgs: [
							'http://cs.zhangkaixing.com/face/face.jpg',
							'http://cs.zhangkaixing.com/face/p10.jpg',
							'http://cs.zhangkaixing.com/face/face_14.jpg',
							'http://cs.zhangkaixing.com/face/face.jpg',
							'http://cs.zhangkaixing.com/face/p10.jpg',
						]
					},
					{
						content: "中评",
						create_time: "2019-04-12",
						header_img: "http://cs.zhangkaixing.com/face/face_12.jpg",
						user_name: "测试2",
						rate: 4,
						// imgs:[]
					},
					{
						content: "",
						create_time: "2019-04-12",
						header_img: "http://cs.zhangkaixing.com/face/face_15.jpg",
						user_name: "测试3",
						rate: 2,
						// imgs:[]
					}, {
						content: "好评",
						create_time: "2019-04-12",
						header_img: "http://cs.zhangkaixing.com/face/face_2.jpg",
						user_name: "测试1",
						rate: 5,
						imgs: [
							'http://cs.zhangkaixing.com/face/face.jpg',
							'http://cs.zhangkaixing.com/face/p10.jpg',
							'http://cs.zhangkaixing.com/face/face_14.jpg',
							'http://cs.zhangkaixing.com/face/face.jpg',
							'http://cs.zhangkaixing.com/face/p10.jpg',
						]
					},
					{
						content: "中评",
						create_time: "2019-04-12",
						header_img: "http://cs.zhangkaixing.com/face/face_12.jpg",
						user_name: "测试2",
						rate: 3.5,
						// imgs:[]
					},
					{
						content: "",
						create_time: "2019-04-12",
						header_img: "http://cs.zhangkaixing.com/face/face_15.jpg",
						user_name: "测试3",
						rate: 2.3,
						// imgs:[]
					}
				]
			}
		},
		onLoad(options) {
			this.activateId = options.activateId
			console.log("this.activateId =>", options.activateId)
		},
		onShow() {
			this.userId = this.$store.state.user.id;
			console.log("userInfor =>", this.$store.state.user)
			console.log("onShow")
			this.Init(this.activateId)
		},
		methods: {
			async createComment(activateId, userId) {

			},
			async Init(activateId) {
				const res = await GetActivateComment(activateId)
				res.data.data.reactivate_comment.forEach(item => {
					this.listData.unshift({
						"content": item.comment,
						"create_time": item.CreatedAt,
						"rate": item.rate,
						"imgs": item.imageUrl,
					});
				});
			}
		}
	}
</script>

<style>
	.bottom-element {

		position: fiexd;
		bottom: 0upx;
	}
</style>